/*
 * Copyright (c) 2024. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
 * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
 * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
 * Vestibulum commodo. Ut rhoncus gravida arcu.
 */

package org.example.provider.triple.impl;

import com.google.protobuf.Empty;
import com.googlecode.protobuf.format.JsonFormat;
import org.apache.dubbo.config.annotation.DubboService;
import org.example.provider.triple.CidReply;
import org.example.provider.triple.CidRequest;
import org.example.provider.triple.CidService;
import org.example.provider.triple.DubboCidServiceTriple;
import reactor.core.publisher.Mono;

/**
 * @author xieqing
 * @email xieqing@kanzhun.com
 * @description
 * @date 2024-02-28 14:42
 */
@DubboService(group = "group1", version = "1.0",loadbalance = "cid")
//@DubboService(group = "group1", version = "1.0")
public class CidServiceImpl extends DubboCidServiceTriple.CidServiceImplBase {

    @Override
    public Mono<CidReply> cidTest(Mono<CidRequest> reactorRequest) {
        return reactorRequest.map(item->CidReply.newBuilder().setCid(1).setMessage("hi").build());
    }

    @Override
    public Mono<Empty> cidTestReturnEmpty(Mono<CidRequest> request) {
        return request.map(item-> {
            System.out.println(new JsonFormat().printToString(item));
            return Empty.newBuilder().build();
        });
    }
}
